print function hackerrank solution